package net.mhelvens.deltaprofiles;

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;

public abstract class BaseMonitor extends Service {
	public static final String ACTION_START_MONITORING = "net.mhelvens.deltaprofiles.ACTION_START_MONITORING";
	public static final String ACTION_STOP_MONITORING  = "net.mhelvens.deltaprofiles.ACTION_STOP_MONITORING";

	@Override
	public IBinder onBind(Intent intent) {
		return null;
	}
	
	@Override
	public int onStartCommand(Intent intent, int flags, int startId) {
		if (intent.getAction().equals(ACTION_START_MONITORING)) {
			onStart();
		}
		
		if (intent.getAction().equals(ACTION_STOP_MONITORING )) {
			onStop();
			stopSelf();
		}
		
		return super.onStartCommand(intent, flags, startId);
	}
	
	protected abstract void onStart();
	
	protected void onStop() {
		
	}
}
